package com.online.questionnaire.scheduling;

import com.online.questionnaire.service.SurveysService;
import jakarta.annotation.PostConstruct;
import jakarta.annotation.Resource;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * 问卷相关定时任务
 */
@Component
public class SurveyScheduling {

    @Resource
    private SurveysService surveyService;

    /**
     * 定时修正问卷 状态
     * 每十分钟执行一次
     */
    @PostConstruct
    @Scheduled(cron = "0 0/10 * * * ?")
    public void updateSurveyStatus(){
        System.out.println("定时修正问卷 状态");
        surveyService.updateSurveyStatus();
    }

}
